﻿using System;
using System.Diagnostics;
using LINQPad.OpenAccess.Helpers;
using Telerik.OpenAccess.Metadata;

namespace LINQPad.OpenAccess.Metadata
{
    /// <summary>
    ///   <see cref="IMetadataSourceInfo" />.
    /// </summary>
    public class MetadataSourceInfo : IMetadataSourceInfo
    {
        #region Private

        #region - Vars

        [DebuggerBrowsable( DebuggerBrowsableState.Never )]
        private readonly string _name, _path;
        [DebuggerBrowsable( DebuggerBrowsableState.Never )]
        private readonly MappingDefinitionType _mappingDefinitionType;

        #endregion

        #endregion

        #region Public

        #region - Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="MetadataSourceInfo" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public MetadataSourceInfo( string name )
            : this( name, String.Empty, MappingDefinitionType.Xml ) { }
        /// <summary>
        /// Initializes a new instance of the <see cref="MetadataSourceInfo" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="path">The path.</param>
        public MetadataSourceInfo( string name, string path, MappingDefinitionType mappingDefinitionType )
        {
            Guard.ArgumentNotNullOrEmpty( name, "name" );
            Guard.ArgumentNotNull( path, "path" );

            this._name = name;
            this._path = path;
            this._mappingDefinitionType = mappingDefinitionType;
        }

        #endregion

        #endregion

        #region IMetadataSourceInfo Members

        /// <summary>
        /// Gets the type of the mapping.
        /// </summary>
        /// <value>
        /// The type of the mapping.
        /// </value>
        public MappingDefinitionType MappingType
        {
            get
            {
                return this._mappingDefinitionType;
            }
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        public string Name
        {
            get { return this._name; }
        }

        /// <summary>
        /// Gets the path.
        /// </summary>
        /// <value>
        /// The path.
        /// </value>
        public string Path
        {
            get { return this._path; }
        }

        #endregion
    }
}